package ymjy;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 批量生成权限SQL
 * @author DengZhiYuan
 * @version 1.0
 * @date 2021/12/6 21:01
 */
public class ResourceNewAdd {

    public static void main(String[] args) {
        new ResourceNewAdd().print2();
    }

    private void print1(){
        List<String> all = Arrays.asList("lukuan",
                "songjinfeng",
                "tce002",
                "zhangshanshan",
                "lina",
                "zhubo",
                "cs01",
                "chaitanxiao",
                "dipu",
                "wangyichen",
                "liuyaling",
                "yangming",
                "cs009",
                "cs008",
                "test1",
                "huangchuanna",
                "tce001",
                "data",
                "report",
                "jyjd",
                "donghang",
                "kangyongqi",
                "lianglingnan",
                "yulong",
                "shiping",
                "jixueying",
                "Duty",
                "wangjuhua",
                "yangguangliang",
                "liulili",
                "lr001",
                "zhoushengnan",
                "yuanmengluru4",
                "shaojianjie",
                "opadmin",
                "songjianda",
                "renruifeng",
                "mayawei");

        String sql1 = "INSERT INTO UM_RESOURCE_OWNER(\"ID\", \"RESOURCE_ID\", \"OWNER_ID\", \"ASSIGN_TYPE\", \"CREATE_USER_ID\", \"CREATE_TIME\", \"IS_DELETED\") \n" +
                "  VALUES ('%s', 'ff8080817cda1155017cdf6fd0640043', '%s', '2', '1', SYSDATE, '0');";
        String sql2 = "INSERT INTO UM_RESOURCE_OWNER(\"ID\", \"RESOURCE_ID\", \"OWNER_ID\", \"ASSIGN_TYPE\", \"CREATE_USER_ID\", \"CREATE_TIME\", \"IS_DELETED\") \n" +
                " VALUES ('%s', 'ff8080817cda1155017cdf70ba3e0044', '%s', '2', '1', SYSDATE, '0');";

        List<String> allSql = new ArrayList<>();
        String prefix = "dzy080817cda1155017cdf70bbc";
        Integer val = 10000;
        for (int i = 0; i < all.size(); i++) {
            String userName = all.get(i);
            val = val +1;
            allSql.add(String.format(sql1, prefix+val,userName));
            val = val +1;
            allSql.add(String.format(sql2, prefix+val,userName));
        }
        allSql.forEach(e->{
            System.out.println(e);
        });

    }

    private void  print2(){
        List<String> all = Arrays.asList("jyjd",
                "songjianda",
                "zhoushengnan",
                "cs009",
                "tce001",
                "liulili",
                "zhangshanshan",
                "Duty",
                "opadmin",
                "tce002",
                "yulong",
                "yuanmengluru4");

        String sql1 = "INSERT INTO UM_RESOURCE_OWNER(\"ID\", \"RESOURCE_ID\", \"OWNER_ID\", \"ASSIGN_TYPE\", \"CREATE_USER_ID\", \"CREATE_TIME\", \"IS_DELETED\") \n" +
                "  VALUES ('%s', '40289b6a51f5750d0151f576cee90002', '%s', '2', '1', SYSDATE, '0');";

        List<String> allSql = new ArrayList<>();
        String prefix = "dzy080817cda1155017cdf70bbc";
        Integer val = 20000;
        for (int i = 0; i < all.size(); i++) {
            String userName = all.get(i);
            val = val +1;
            allSql.add(String.format(sql1, prefix+val,userName));
        }
        allSql.forEach(e->{
            System.out.println(e);
        });
    }


}
